package com.deparse.mydialog.animation;

import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.deparse.mydialog.MainActivity;
import com.deparse.mydialog.R;
import com.deparse.mydialog.common.BaseActivity;
import com.deparse.mydialog.dialog.AndroidDialog;

/**
 * Created by Administrator on 2016/7/18.
 */
public class TranslationAnimationActivity extends BaseActivity {
    private ImageView image_flip, image_flip1, image_flip2;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_flip_animation);
        image_flip = (ImageView) findViewById(R.id.image_flip);
        image_flip.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                ObjectAnimator animator = ObjectAnimator.ofFloat(image_flip, "translation", 0, 360, 0);
                animator.setDuration(2000);
                animator.start();

            }
        });
        image_flip1 = (ImageView) findViewById(R.id.image_flip1);
        image_flip1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ObjectAnimator animator = ObjectAnimator.ofFloat(image_flip1, "translationX", 0, 360, 0);
                animator.setDuration(2000);
                animator.start();
                finishActivity(AndroidDialog.class.getSimpleName(), MainActivity.class.getSimpleName());
            }
        });
        image_flip2 = (ImageView) findViewById(R.id.image_flip2);
        image_flip2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ObjectAnimator animator = ObjectAnimator.ofFloat(image_flip2, "translationY", 0, 360, 0);
                animator.setDuration(2000);
                animator.start();
            }
        });

    }
}
